 
 
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>面板 - 页面元素 - Layui</title>
<meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black"> 
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no">
  <script>
  ;!function(){self!==parent&&(location.href="//www.baidu.com/")}();
  </script>
  <link rel="stylesheet" href="../../layui/dist/css/layui.css" media="all">
  <link rel="stylesheet" href="../../static/css/global.css" media="all">
</head>
<body><div class="layui-header header header-doc" autumn="">
  <div class="layui-container">
    <a class="logo" href="../../index.html">
      <img src="../../static/images/layui/logo.png" alt="layui">
    </a>
    <div class="layui-form layui-hide-xs component" lay-filter="LAY-site-header-component"></div>
    <div class="layui-hide-xs site-notice"></div>
    
    <ul class="layui-nav" id="LAY_NAV_TOP">
      <li class="layui-nav-item layui-this">
        <a href="../index.html">文档</a> 
      </li>
      <li class="layui-nav-item ">
        <a href="../../demo/index.html">示例</a>
      </li>
      
      <li class="layui-nav-item">
        <a href="javascript:;">
          <!--<span class="layui-badge-dot" style="left:0; right: auto; margin: -4px 0 0 5px;"></span>--> 
          周边
        </a>
        <dl class="layui-nav-child layui-nav-child-c">  
          <dd class="layui-hide-sm layui-show-xs" lay-unselect="">
            <a href="javascript:window.open('https://gitee.com/sentsin/layui/issues');" target="_blank" rel="nofollow">问题反馈</a>
            <hr>
          </dd>
          
          <dd lay-unselect=""><a href="../../alone.html" target="_blank" lay-unselect="">独立组件</a></dd>
          <dd lay-unselect=""><a href="../../extend/index.html" target="_blank">扩展组件</a></dd>
        </dl>
      </li>
      
      
    </ul>
  </div>
</div>
 
<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
<!--[if lt IE 9]>
  <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
 
<ul class="site-dir">
  <li><a href="#panel"><cite>常规面板</cite></a></li>
  <li><a href="#card"><cite>卡片面板</cite></a></li>
  <li><a href="#collapse"><cite>折叠面板</cite></a></li>
  <li><a href="#accordion"><cite>开启手风琴</cite></a></li>
  <li><a href="../modules/element.html#collapse"><cite>相关动态操作</cite></a></li>
</ul>
<div class="layui-container layui-row">
  
<div class="layui-col-md3">
  <div class="layui-panel site-menu">
    <ul class="layui-menu layui-menu-lg">
      <li class="layui-menu-item-group" lay-options="{type: 'group', isAllowSpread: true}">
        <div class="layui-menu-body-title">
          基础说明
        </div>
        <hr>
        <ul>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../index.html">
                <span>开始使用 </span> 
                <span class="layui-font-12 layui-font-gray">Getting Started</span>
              </a>
              
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../base/infrastructure.html">
                <span>底层方法 </span>
                <span class="layui-font-12 layui-font-gray">基础支撑</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../base/element.html">
                <span>页面元素 </span>
                <span class="layui-font-12 layui-font-gray">规范 公共类 属性</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../base/modules.html">
                <span>模块规范 </span>
                <span class="layui-font-12 layui-font-gray">使用 扩展</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../base/faq.html">
                <span>常见问题 </span>
                <span class="layui-font-12 layui-font-gray">FAQ</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../base/changelog.html">
                <span>更新日志 </span>
                <span class="layui-font-12 layui-font-gray">changelog</span>
                
                  <span class="layui-badge-dot"></span>
                
              </a>
            </div>
          </li>
        </ul>
      </li>
      
      <li class="layui-menu-item-group" lay-options="{type: 'group', isAllowSpread: true}">
        <div class="layui-menu-body-title">
          页面元素
        </div>
        <hr>
        <ul>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="layout.html">
                <span>布局 </span>
                <span class="layui-font-12 layui-font-gray">栅格 后台管理布局</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="color.html">
                <span>颜色 </span>
                <span class="layui-font-12 layui-font-gray">主色调 颜色搭配</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="icon.html">
                <span>图标 </span>
                <span class="layui-font-12 layui-font-gray">iconfont 字体图标</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="anim.html">
                <span>动画 </span>
                <span class="layui-font-12 layui-font-gray">内置 CSS3 动画</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="button.html">
                <span>按钮 </span>
                <span class="layui-font-12 layui-font-gray">button</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="form.html">
                <span>表单 </span>
                <span class="layui-font-12 layui-font-gray">form 元素集合</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="nav.html">
                <span>导航 </span>
                <span class="layui-font-12 layui-font-gray">nav 面包屑</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="menu.html">
                <span>菜单 </span>
                <span class="layui-font-12 layui-font-gray">menu 基础菜单</span>
                
                  <span class="layui-badge-dot"></span>
                
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="tab.html">
                <span>选项卡 </span>
                <span class="layui-font-12 layui-font-gray">Tabs 切换</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="progress.html">
                <span>进度条 </span>
                <span class="layui-font-12 layui-font-gray">progress</span>
              </a>
            </div>
          </li>
          <li class="layui-menu-item-checked2">
            <div class="layui-menu-body-title">
              <a href="">
                <span>面板 </span>
                <span class="layui-font-12 layui-font-gray">panel 卡片 折叠</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="table.html">
                <span>表格 </span>
                <span class="layui-font-12 layui-font-gray">静态 table</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="badge.html">
                <span>徽章 </span>
                <span class="layui-font-12 layui-font-gray">小圆点  小边框</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="timeline.html">
                <span>时间线 </span>
                <span class="layui-font-12 layui-font-gray">timeline</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="auxiliar.html">
                <span>辅助 </span>
                <span class="layui-font-12 layui-font-gray">引用 字段集 横线等</span>
              </a>
            </div>
          </li>
        </ul>
      </li>
      
      <li class="layui-menu-item-group" lay-options="{type: 'group', isAllowSpread: true}">
        <div class="layui-menu-body-title">
          内置模块
        </div>
        <hr>
        <ul>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/layer.html">
                <span>弹出层 </span>
                <span class="layui-font-12 layui-font-gray">layer</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/laydate.html">
                <span>日期与时间选择 </span>
                <span class="layui-font-12 layui-font-gray">laydate</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/laypage.html">
                <span>分页 </span>
                <span class="layui-font-12 layui-font-gray">laypage</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/laytpl.html">
                <span>模板引擎 </span>
                <span class="layui-font-12 layui-font-gray">laytpl</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/table.html">
                <span>数据表格 </span>
                <span class="layui-font-12 layui-font-gray">table</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/form.html">
                <span>表单 </span>
                <span class="layui-font-12 layui-font-gray">form</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/upload.html">
                <span>文件上传 </span>
                <span class="layui-font-12 layui-font-gray">upload</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/dropdown.html">
                <span>下拉菜单 </span>
                <span class="layui-font-12 layui-font-gray">dropdown</span>
                
                  <span class="layui-badge-dot"></span>
                
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/transfer.html">
                <span>穿梭框 </span>
                <span class="layui-font-12 layui-font-gray">transfer</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/tree.html">
                <span>树形组件 </span>
                <span class="layui-font-12 layui-font-gray">tree</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/colorpicker.html">
                <span>颜色选择器 </span>
                <span class="layui-font-12 layui-font-gray">colorpicker</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/element.html">
                <span>常用元素操作 </span>
                <span class="layui-font-12 layui-font-gray">element</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/slider.html">
                <span>滑块 </span>
                <span class="layui-font-12 layui-font-gray">slider</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/rate.html">
                <span>评分 </span>
                <span class="layui-font-12 layui-font-gray">rate</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/carousel.html">
                <span>轮播 </span>
                <span class="layui-font-12 layui-font-gray">carousel</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/flow.html">
                <span>流加载 </span>
                <span class="layui-font-12 layui-font-gray">flow</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/util.html">
                <span>工具组件 </span>
                <span class="layui-font-12 layui-font-gray">util</span>
              </a>
            </div>
          </li>
          <li class="">
            <div class="layui-menu-body-title">
              <a href="../modules/code.html">
                <span>代码高亮显示 </span>
                <span class="layui-font-12 layui-font-gray">code</span>
              </a>
            </div>
          </li>
        </ul>
      </li>
    </ul>
  </div>
  <div class="layui-hide-v"> - </div>
</div>

  
  <div class="layui-col-md9 site-content">
    <h1 class="site-h1">面板 - 页面元素</h1>
    <blockquote class="site-text layui-elem-quote">
      一般的面板通常是指一个独立的容器，而折叠面板则能有效地节省页面的可视面积，非常适合应用于：QA说明、帮助文档等
    </blockquote>
    <blockquote class="site-text layui-elem-quote">
      依赖加载组件：<a href="../modules/element.html">element</a>
    </blockquote>
    
    
    
     <div class="site-title">
      <fieldset><legend><a name="panel">常规面板</a></legend></fieldset>
    </div>
    <div class="layui-tab layui-tab-brief layui-code-demo">
      <ul class="layui-tab-title">
        <li class="layui-this">效果</li>
        <li>代码</li>
      </ul>
      <div class="layui-tab-content layui-border layui-bg-gray">
        <div class="layui-tab-item layui-show" id="docDemoView1">
       
        </div>
        <div class="layui-tab-item">
          <pre class="layui-code" id="docDemoCode1" lay-lang="HTML" lay-encode="1" lay-height="360px">
<div class="layui-row layui-col-space15">
  <div class="layui-col-md6">
    <div class="layui-panel">
      <div style="padding: 30px;">一个面板</div>
    </div>   
  </div>
  <div class="layui-col-md6">
    <div class="layui-panel">
      <div style="padding: 30px;">一个面板</div>
    </div>   
  </div>
</div>    
          </pre>
        </div>
      </div>
    </div>
    
    <div class="site-text">
      <p class="layui-font-red">
        提示：该功能为 layui 2.6.0 新增
      </p>
    </div>
    
    <div class="site-title">
      <fieldset><legend><a name="card">卡片面板</a></legend></fieldset>
    </div> 
    
    <div style="padding: 20px; background-color: #F2F2F2;">
      <div class="layui-row layui-col-space15">
        <div class="layui-col-md6">
          <div class="layui-card">
            <div class="layui-card-header">卡片面板</div>
            <div class="layui-card-body">
              卡片式面板面板通常用于非白色背景色的主体内<br>
              从而映衬出边框投影
            </div>
          </div>
        </div>
        <div class="layui-col-md6">
          <div class="layui-card">
            <div class="layui-card-header">卡片面板</div>
            <div class="layui-card-body">
              结合 layui 的栅格系统<br>
              轻松实现响应式布局
            </div>
          </div>
        </div>
      </div>
    </div>
    
    <pre class="layui-code" lay-title="对应的HTML结构">
&lt;div class=&quot;layui-card&quot;&gt;
  &lt;div class=&quot;layui-card-header&quot;&gt;卡片面板&lt;/div&gt;
  &lt;div class=&quot;layui-card-body&quot;&gt;
    卡片式面板面板通常用于非白色背景色的主体内&lt;br&gt;
    从而映衬出边框投影
  &lt;/div&gt;
&lt;/div&gt;
    </pre>
    
    <p>如果你的网页采用的是默认的白色背景，不建议使用卡片面板。</p>
    
    <div class="site-title">
      <fieldset><legend><a name="collapse">折叠面板</a></legend></fieldset>
    </div>    
    <div class="site-text">
    
      <div class="layui-collapse">
        <div class="layui-colla-item">
          <h2 class="layui-colla-title">杜甫</h2>
          <div class="layui-colla-content layui-show">
            <p>杜甫的思想核心是儒家的仁政思想，他有“致君尧舜上，再使风俗淳”的宏伟抱负。杜甫虽然在世时名声并不显赫，但后来声名远播，对中国文学和日本文学都产生了深远的影响。杜甫共有约1500首诗歌被保留了下来，大多集于《杜工部集》。</p>
          </div>
        </div>
        <div class="layui-colla-item">
          <h2 class="layui-colla-title">李清照</h2>
          <div class="layui-colla-content">
            <p>李清照出生于书香门第，早期生活优裕，其父李格非藏书甚富，她小时候就在良好的家庭环境中打下文学基础。出嫁后与夫赵明诚共同致力于书画金石的搜集整理。金兵入据中原时，流寓南方，境遇孤苦。所作词，前期多写其悠闲生活，后期多悲叹身世，情调感伤。形式上善用白描手法，自辟途径，语言清丽。</p>
          </div>
        </div>
        <div class="layui-colla-item">
          <h2 class="layui-colla-title">鲁迅</h2>
          <div class="layui-colla-content">
            <p>鲁迅一生在文学创作、文学批评、思想研究、文学史研究、翻译、美术理论引进、基础科学介绍和古籍校勘与研究等多个领域具有重大贡献。他对于五四运动以后的中国社会思想文化发展具有重大影响，蜚声世界文坛，尤其在韩国、日本思想文化领域有极其重要的地位和影响，被誉为“二十世纪东亚文化地图上占最大领土的作家”。</p>
          </div>
        </div>
      </div>
      
      <p style="margin-top: 10px;">通过对内容元素设置class为 <em>layui-show</em> 来选择性初始展开某一个面板，element 模块会自动呈现状态图标。</p>
      
      <pre class="layui-code" lay-title="对应的HTML结构">
&lt;div class=&quot;layui-collapse&quot;&gt;
  &lt;div class=&quot;layui-colla-item&quot;&gt;
    &lt;h2 class=&quot;layui-colla-title&quot;&gt;杜甫&lt;/h2&gt;
    &lt;div class=&quot;layui-colla-content layui-show&quot;&gt;内容区域&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;layui-colla-item&quot;&gt;
    &lt;h2 class=&quot;layui-colla-title&quot;&gt;李清照&lt;/h2&gt;
    &lt;div class=&quot;layui-colla-content layui-show&quot;&gt;内容区域&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;layui-colla-item&quot;&gt;
    &lt;h2 class=&quot;layui-colla-title&quot;&gt;鲁迅&lt;/h2&gt;
    &lt;div class=&quot;layui-colla-content layui-show&quot;&gt;内容区域&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
 
&lt;script&gt;
//注意：折叠面板 依赖 element 模块，否则无法进行功能性操作
layui.use('element', function(){
  var element = layui.element;
  
  //…
});
&lt;/script&gt;
      </pre>
    </div>
    
    
    <div class="site-title">
      <fieldset><legend><a name="accordion">开启手风琴</a></legend></fieldset>
    </div>    
    <div class="site-text">
    
      <div class="layui-collapse" lay-accordion="">
        <div class="layui-colla-item">
          <h2 class="layui-colla-title">杜甫</h2>
          <div class="layui-colla-content layui-show">
            <p>杜甫的思想核心是儒家的仁政思想，他有“致君尧舜上，再使风俗淳”的宏伟抱负。杜甫虽然在世时名声并不显赫，但后来声名远播，对中国文学和日本文学都产生了深远的影响。杜甫共有约1500首诗歌被保留了下来，大多集于《杜工部集》。</p>
          </div>
        </div>
        <div class="layui-colla-item">
          <h2 class="layui-colla-title">李清照</h2>
          <div class="layui-colla-content">
            <p>李清照出生于书香门第，早期生活优裕，其父李格非藏书甚富，她小时候就在良好的家庭环境中打下文学基础。出嫁后与夫赵明诚共同致力于书画金石的搜集整理。金兵入据中原时，流寓南方，境遇孤苦。所作词，前期多写其悠闲生活，后期多悲叹身世，情调感伤。形式上善用白描手法，自辟途径，语言清丽。</p>
          </div>
        </div>
        <div class="layui-colla-item">
          <h2 class="layui-colla-title">鲁迅</h2>
          <div class="layui-colla-content">
            <p>鲁迅一生在文学创作、文学批评、思想研究、文学史研究、翻译、美术理论引进、基础科学介绍和古籍校勘与研究等多个领域具有重大贡献。他对于五四运动以后的中国社会思想文化发展具有重大影响，蜚声世界文坛，尤其在韩国、日本思想文化领域有极其重要的地位和影响，被誉为“二十世纪东亚文化地图上占最大领土的作家”。</p>
          </div>
        </div>
      </div>
      
      <p style="margin-top: 10px;">在折叠面板的父容器设置属性 <em>lay-accordion</em> 来开启手风琴，那么在进行折叠操作时，始终只会展现当前的面板。</p>
      
      <pre class="layui-code" lay-title="对应的HTML结构">
&lt;div class=&quot;layui-collapse&quot; <a>lay-accordion</a>&gt;
  &lt;div class=&quot;layui-colla-item&quot;&gt;
    &lt;h2 class=&quot;layui-colla-title&quot;&gt;杜甫&lt;/h2&gt;
    &lt;div class=&quot;layui-colla-content layui-show&quot;&gt;内容区域&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;layui-colla-item&quot;&gt;
    &lt;h2 class=&quot;layui-colla-title&quot;&gt;李清照&lt;/h2&gt;
    &lt;div class=&quot;layui-colla-content layui-show&quot;&gt;内容区域&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;layui-colla-item&quot;&gt;
    &lt;h2 class=&quot;layui-colla-title&quot;&gt;鲁迅&lt;/h2&gt;
    &lt;div class=&quot;layui-colla-content layui-show&quot;&gt;内容区域&lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
      </pre>
    </div>
    
    
    
    <div class="layui-elem-quote">
  <p>layui - 在每一个细节中，用心与你沟通</p>
</div>
    
  </div>
</div>
<script>
window.global = {
  pageType: 'doc'
  ,preview: function(){
    var preview = document.getElementById('LAY_preview');
    return preview ? preview.innerHTML : '';
  }()
};
</script>
<script async="" src="../../pagead/js/adsbygoogle.js"></script>
<div class="site-tree-mobile layui-hide">
  <i class="layui-icon layui-icon-spread-left"></i>
</div>
<div class="site-mobile-shade"></div>
 
<script src="../../layui/dist/layui.js" ></script>
<script>
layui.config({
  base: '../../static/lay/modules/layui/'
  ,version: '1632428048260'
}).use('global');
</script>
 <script>
global.docDemoCode1 = document.getElementById('docDemoCode1').innerHTML;
layui.use(['element', 'layer', 'util'], function(){
  var element = layui.element
  ,layer = layui.layer
  ,$ = layui.jquery
  ,util = layui.util;
  
  element.on('tab(docDemoTabBrief)', function(data){
    layer.msg('切到到了'+ data.index + '：' + this.innerHTML);
  });
  
  $('#docDemoView1').html(util.unescape(global.docDemoCode1));
});
</script>
</body>
</html>